import {
    app,
    BrowserWindow,
} from "electron"
import path from "path"

const createWindow = () => {
    const mainWindow = new BrowserWindow({
        width: 800,
        height: 600,
        webPreferences: {
            contextIsolation: false,
            nodeIntegration: true,
        },
    })
    if (app.isPackaged) {
        mainWindow.loadFile(path.join(__dirname, "../index.html"))
    } else {
        const url = "http://localhost:5173"
        mainWindow.loadURL(url)
    }
    console.log(`中文测试`)
}

app.whenReady().then(() => {
    createWindow()
})

app.on("window-all-closed", () => {
    app.quit()
})